package com.demo.webflux.spring5core.test.service;

import java.util.HashMap;
import java.util.Map;

import com.demo.webflux.spring5core.framework.annotation.Autowired;
import com.demo.webflux.spring5core.framework.annotation.Controller;
import com.demo.webflux.spring5core.framework.annotation.RequestMapping;
import com.demo.webflux.spring5core.framework.annotation.RequestParam;
import com.demo.webflux.spring5core.framework.webmvc.ModelAndView;

@Controller
@RequestMapping("/")
public class PageAction {

	@Autowired
	private QueryService queryService;

	@RequestMapping("/first.html")
	public ModelAndView query(@RequestParam("teacher") String teacher) {
		String result = queryService.query(teacher);
		Map<String, Object> model = new HashMap<>();
		model.put("teacher", teacher);
		model.put("data", result);
		model.put("token", "123456");
		return new ModelAndView("first.html", model);
	}

}
